<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;

class UploadController extends Controller
{
    //上传图片
    public function image(Request $request)
    {
        if ($request->hasFile('file')) {
            $path = upload_image('file','image',150);

            return [
                'image' => $path,
                'full_image' => image_url($path),
            ];
        } else {
            return invalidation('Please select image file');
        }
    }
}
